//输入一个整数返回组成它的数字之和

import java.util.Scanner;
public class sumAndadd {
    public static int Sum(int num)
    {
        if(num < 10)
            return num;
        return num % 10 + Sum(num / 10);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        System.out.println(Sum(num));
    }
}
